<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
	<link rel="stylesheet" type="text/css" href="../../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../../css/common.css" />
	<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
  <title>学术</title>
  <style>
		html, body {width: 100%;min-height: 100%;background: #fff;}
    .h20 {height: 0.5rem;background: #f0f0f0;}

            #header_top {
                background: #2997e4;
                padding-top: 25px;
            }
    .detail_con {
      padding: 1rem 1rem 3rem;
    }
    .detail_title h3 {
      font-size: 0.9rem;
      color: #333;
    }
    .detail_addtime h6 {
      font-size: 0.6rem;
      color: #999;
      margin: 1rem 0;
    }
    .detail_time h5 {
      font-size: 0.75rem;
      color: #333;
      margin: 1rem 0;
    }
    .detail_address h5 {
      font-size: 0.75rem;
      color: #333;
      margin: 1rem 0;
    }
    .detail_tit_sm h4 {
      font-size: 0.75rem;
      color: #333;
      font-weight: bold;
      line-height: 1.2rem;
    }
    .detail_text p {
      font-size: 0.75rem;
      line-height: 1.2rem;
      color: #333;
      margin: 1rem 0;
    }
    .ml_btns {
      position: fixed;
      bottom: 0;
      width: 100%;
    }
    .ml_btn {
      float: left;
      width: 100%;
      padding: 0.5rem 0;
      text-align: center;
      background: #2997e4;
      color: #fff;
    }
    #header_top {
      position: fixed;
      top:0;
      width: 100%;
    }
    .detail_con {
      padding-top: calc(1rem + 65px);
    }
	</style>
</head>
<body>
<header id="header_top" class="aui-bar aui-bar-nav" >

  <a class="aui-pull-left"  onclick="goback()">
      <span class="aui-iconfont aui-icon-left"></span>
  </a>
  <div class="aui-title" id="title">
  会议详情
</div>
</header>
  <div id="app" v-cloak>
<div class="detail_con">
  <div class="detail_title">
    <h3>{{info.title}}</h3>
  </div>
  <div class="detail_addtime">
    <h6>{{info.create_date}}</h6>
  </div>
  <div class="detail_time">
    <h5>时间: {{info.apply_date}} ~ {{info.activity_end_date}}</h5>
  </div>
  <div class="detail_address">
    <h5>地点: {{info.address}}</h5>
  </div>
  <div class="detail_tit_sm">
    <h4>会议简介</h4>
  </div>
  <div class="detail_text" v-html="info.content"></div>
</div>
<div class="ml_btns">
  <div class="ml_btn" @click="openDetail('hybm', '我要报名', id, info)" v-if="info.status == 4">
    审核拒绝
  </div>
    <div class="ml_btn" @click="openDetail('hybm', '我要报名', id, info)" v-else-if="info.status == 1">
      我要报名
    </div>
      <div class="ml_btn" v-else-if="info.status == 2">
        待审核
      </div>
        <div class="ml_btn" @click="xqbm" v-else-if="info.status == 3">
          取消报名
        </div>
</div>
</div>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script>
function goback () {
  api.closeWin();

}
apiready = function() {

  var app = new Vue({
    el: '#app',
    data: {
      id: 0,
      info: {},
      token: $api.getStorage('token')
    },
    created: function() {
      var $_this = this;
      if(!$api.getStorage('token')){
        api.confirm( {
            title: '是否登录',
            msg: '确认是否登录？',
            buttons: [ '确定', '取消' ]
          }, function ( ret, err ) {
            var index = ret.buttonIndex;
            if ( index == 1 ) {
              api.openWin({
                name: 'login',
                url: '../five_frame/login_header.html',
                delay: 200,
                bounces: false
              });
              return;
            } else {
              api.closeWin({
                  name: name
              });
              return
            }
          })
          return
        }
      $_this.id = api.pageParam.id
      api.ajax({
        url: window.Url.getMeetingDetail + $_this.id,
        timeout: 300,
        headers: {
					  'baseParams': $api.getStorage('token') //token
					},
      }, function(ret, err) {
          if (ret) {
              // console.log( JSON.stringify(ret) );
              $_this.info = ret.data
          } else {
              api.alert({ msg: JSON.stringify(err) });
          }
      })
    },
    methods: {
      openDetail:function (type, title, id, data) {
        api.openWin({
          name: 'index_detail_' + type,
          pageParam: {
            name: 'index_detail_' + type,
            title: title,
            id: id,
            data: data
          },
          url: './first_header.html',
          delay: 200,
          bounces: false
        });
      },
      xqbm: function () {
        var $_this = this;
        api.confirm( {
        title: '取消报名',
        msg: '确认取消报名？',
        buttons: [ '确定', '取消' ]
      }, function ( ret, err ) {
        var index = ret.buttonIndex;
        if ( index == 1 ) {
          api.ajax({
            url: window.Url.exitMeet + $_this.id,
            timeout: 300,
            headers: {
      					  'baseParams': $_this.token //token
      					},
          }, function(ret, err) {
              if (ret) {
                    // console.log(JSON.stringify(ret));
                    if (ret.code == 0) {
                      $_this.info.status = 1
                      api.toast({ msg: '取消报名成功',duration: 2000,location:'middle' });
                    } else {
                      api.toast({ msg: ret.message,duration: 2000,location:'middle' });
                    }
              } else {
                  api.alert({ msg: JSON.stringify(err) });
              }
          })
        }
      })
      }
    },
    filters: {
      time: function (value) {
        value = new Date(value)
        return value.getFullYear() + '-' + value.getMonth() + '-' + value.getDate() + ' ' + value.getHours() + ':' + value.getMinutes() + ':' + value.getSeconds()
      }
    }
  })
}
</script>
</body>
</html>
